import 'package:business_getx/business_getx.dart';
import 'package:flutter/material.dart';
import 'package:lib_core/lib_core.dart';
import 'package:lib_ui/lib_ui.dart';

class ThemePage extends StatefulWidget {
  const ThemePage({super.key});

  @override
  State<ThemePage> createState() => _ThemePageState();
}

class _ThemePageState extends State<ThemePage> {
  final _themeController = Get.find<ThemeController>();
  late final AppThemeColors? _appThemeColor;

  @override
  void initState() {
    super.initState();
    _appThemeColor = Theme.of(Get.context!).extension<AppThemeColors>();
  }

  @override
  void didChangeDependencies() {
    // TODO: implement didChangeDependencies
    super.didChangeDependencies();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: TransparentAppBar(title: '主题颜色切换'),
      body: SizedBox(
        width: Get.width,
        child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
          const Text('测试文本'),
          TextButton(
            onPressed: () {
              _themeController.toggleTheme();
            },
            child: const Text('切换主题'),
          ),
        ]),
      ),
    );
  }
}
